<%@page import="org.lanqiao.dxzf.entity.Fee"%>
<%@page import="org.lanqiao.dxzf.entity.Paging"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
        <link type="text/css" rel="stylesheet" media="all" href="${pageContext.request.contextPath}/css/global.css" />
        <link type="text/css" rel="stylesheet" media="all" href="${pageContext.request.contextPath}/css/global_color.css" />
        <script language="javascript" type="text/javascript">
	        //分页查询
	        function goPage(page){
	        	location.href="fee_list.do?currentPage="+page;
	        }
        
            //排序按钮的点击事件
            function sort(btnObj) {
                if (btnObj.className == "sort_desc")
                    btnObj.className = "sort_asc";
                else
                    btnObj.className = "sort_desc";
            }

            //启用
            function startFee(fid) {
                var r = window.confirm("确定要启用此资费吗？资费启用后将不能修改和删除。");
                if(r==true){
                	location.href="fee_use.do?fid="+fid;
                }
                document.getElementById("operate_result_info").style.display = "block";
            }
            //删除
            function deleteFee(fid) {
                var r = window.confirm("确定要删除此资费吗？");
                if(r==true){
                	location.href="fee_delete.do?fid="+fid;
                }
                document.getElementById("operate_result_info").style.display = "block";
            }
        </script>        
    </head>
    <body>
        <!--Logo区域开始-->
        <%@include file="../include/header.jsp"%>
        <!--导航区域结束-->
        <!--主要区域开始-->
        <div id="main">
            <form action="" method="">
                <!--排序-->
                <div class="search_add">
                    <div>
                        <input type="button" value="月租" class="sort_asc" onclick="sort(this);" />
                        <input type="button" value="基费" class="sort_asc" onclick="sort(this);" />
                        <input type="button" value="时长" class="sort_asc" onclick="sort(this);" />
                    </div>
                    <input type="button" value="增加" class="btn_add" onclick="location.href='fee_add_show.do'" />
                </div> 
                <!--启用操作的操作提示-->
                <div id="operate_result_info" class="operate_success">
                    <img src="../images/close.png" onclick="this.parentNode.style.display='none';" />
                    删除成功！
                </div>    
                <!--数据区域：用表格展示数据-->     
                <div id="data">            
                    <table id="datalist">
                        <tr>
                            <th>资费ID</th>
                            <th class="width100">资费名称</th>
                            <th>基本时长</th>
                            <th>基本费用</th>
                            <th>单位费用</th>
                            <th>创建时间</th>
                            <th>开通时间</th>
                            <th class="width50">状态</th>
                            <th class="width200"></th>
                        </tr>
                        
                        <c:forEach items="${paging.dataList}" var="fee">
                        	<tr>
	                            <td>${fee.fid}</td>
	                            <%-- <td><a href="fee_detail.do?fid=${fee.fid}&fname=${fee.fname}&fstatus=${fee.fstatus}&fkind=${fee.fkind}&basic_time=${fee.basic_time}&basic_price=${fee.basic_price}&unit_price=${fee.unit_price}&f_create_time=${fee.f_create_time}&f_start_time=${fee.f_start_time}&f_explain=${fee.f_explain}">${fee.fname}</a></td> --%>
	                            <td><a href="fee_detail.do?fid=${fee.fid}">${fee.fname}</a></td>
	                            <td>${fee.basic_time}</td>
	                            <td>${fee.basic_price}</td>
	                            <td>${fee.unit_price}</td>
	                            <td>${fee.f_create_time}</td>
	                            <td>${fee.f_start_time}</td>
	                            <td>${fee.fstatus}</td>
	                            <td>                                
	                                <input type="button" value="启用" class="btn_start" onclick="startFee(${fee.fid});" />
	                                <input type="button" value="修改" class="btn_modify" onclick="location.href='fee_modi.do?fid=${fee.fid}'" />
	                                <input type="button" value="删除" class="btn_delete" onclick="deleteFee(${fee.fid});" />
	                            </td>
                        	</tr>
                        </c:forEach>              
                    </table>
                    <p>业务说明：<br />
                    1、创建资费时，状态为暂停，记载创建时间；<br />
                    2、暂停状态下，可修改，可删除；<br />
                    3、开通后，记载开通时间，且开通后不能修改、不能再停用、也不能删除；<br />
                    4、业务账号修改资费时，在下月底统一触发，修改其关联的资费ID（此触发动作由程序处理）
                    </p>
               </div>
                <!--分页-->
                <div id="pages">
			       <div style="text-align:center; margin-top:40px" id="venderfen">
			        当前第${paging.currentPage }页/共${paging.totalPage }页
			        <c:choose>
			            <c:when test="${paging.currentPage==1&&paging.totalPage==0}">
			
			            </c:when>
			            <c:when test="${paging.currentPage==1&&paging.totalPage==1}">
			
			            </c:when>
			            <c:when test="${paging.currentPage==2&&paging.totalPage==2}">
			                <input type="button" value="首页" onclick="goPage(1)" />
			                <input type="button" value="上一页"
			                    onclick="goPage(${paging.currentPage-1})" />
			            </c:when>
			            <c:when test="${paging.currentPage==1 }">
			            	<input type="button" value="上一页" >
			                <input type="button" value="下一页" onclick="goPage(${paging.currentPage+1})" />
			                <input type="button" value="末页" onclick="goPage(${paging.totalPage})" />
			            </c:when>
			            <c:when test="${paging.currentPage==paging.totalPage }">
			                <input type="button" value="首页" onclick="goPage(1)" />
			                <input type="button" value="上一页"
			                    onclick="goPage(${paging.currentPage-1})" />
			            </c:when>
			            <c:otherwise>
			                <input type="button" value="首页" onclick="goPage(1)" />
			                <input type="button" value="上一页"
			                    onclick="goPage(${paging.currentPage-1})" />
			                <input type="button" value="下一页"
			                    onclick="goPage(${paging.currentPage+1})" />
			                <input type="button" value="末页"
			                    onclick="goPage(${paging.totalPage})" />
			            </c:otherwise>
			        </c:choose>
			    </div> 
                </div>
            </form>
        </div>
        <!--主要区域结束-->
        <div id="footer">
           
        </div>
        <script type="text/javascript" language="javascript">
		var update1 = null;
		update1 = '<%=request.getParameter("update")%>';
		if(update1=='yes'){
			alert("修改成功!");
		}
		if(update1=='no'){
			alert("修改失败!");
		}else{}
        </script>
    </body>
</html>
